#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

// s:采样,r:重建
void s_r(double f, double sr) {
    vector<double> smp, rcp;
    for(double t = 0; t < 1; t += 1/sr) smp.push_back(sin(2 * M_PI * f * t)); // 采样
    for(double t = 0; t < 1; t += 0.01) { // 重建
        double sm = 0;
        for(auto& s : smp) sm += s * sin(2 * M_PI * (&s - &smp[0]) * f * t);
        rcp.push_back(sm);
    }
    cout << "SR: " << sr << "Hz, RCP Pts: " << rcp.size() << endl;
}

int main() {
    double f = 5; // 频率
    s_r(f, 2*f); // 满足Nyquist
    s_r(f, 1.5*f); // 不满足Nyquist
}
